import React from 'react'
import ModalRepoForm from './ModalRepoForm'
import { observer, inject } from 'mobx-react';
import autobind from 'autobind-decorator'

@autobind
@inject(["headerStore"]) @observer
export default class Header extends React.Component {
  get store() {
    return this.props.headerStore
  }
  componentDidMount() {
    this.store.loadHeaderData()
  }

  addRepo(repo) {
    this.store.addRepo(repo)
  }

  render() {
    return (
      <div className="text-left top-header">
        <ModalRepoForm handleNewRepo={ this.addRepo } />
        <div className='col-md-10'>
          { this.store.showElements }
        </div>
        <div className="clearfix"></div>
      </div>
    )
  }
}
